unit uHinarioAdventista;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
  dxSkinsCore, dxSkinOffice2010Black, dxSkinOffice2010Blue,
  dxSkinOffice2010Silver, dxSkinOffice2013White, dxSkinscxPCPainter,
  cxContainer, cxEdit, dxLayoutcxEditAdapters, dxLayoutControlAdapters, Menus,
  StdCtrls, cxButtons, dxLayoutContainer, cxTextEdit, cxMaskEdit, cxSpinEdit,
  dxLayoutControl, cxClasses, DB, cxDBEdit, MemDS, DBAccess, Uni, cxStyles,
  cxCustomData, cxFilter, cxData, cxDataStorage, cxNavigator, cxDBData,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel,
  cxGridCustomView, cxGrid, cxMemo, cxLabel;

type
  TdfmHinarioAdventista = class(TForm)
    dxLayoutControl1Group_Root: TdxLayoutGroup;
    dxLayoutControl1: TdxLayoutControl;
    dxLayoutControl1Group1: TdxLayoutGroup;
    dxLayoutControl1Group2: TdxLayoutGroup;
    btnFechar: TcxButton;
    dxLayoutControl1Item2: TdxLayoutItem;
    edSelecaoNumero: TcxSpinEdit;
    dxLayoutControl1Item1: TdxLayoutItem;
    cxEditStyleController1: TcxEditStyleController;
    qrHinario: TUniQuery;
    cxDBTextEdit1: TcxDBTextEdit;
    dxLayoutControl1Item3: TdxLayoutItem;
    qrHinarioID: TIntegerField;
    qrHinarioNUMERO: TFloatField;
    qrHinarioTITULO: TMemoField;
    qrHinarioLETRA: TMemoField;
    dsHinario: TDataSource;
    edTextoPesquisa: TcxTextEdit;
    dxLayoutControl1Item4: TdxLayoutItem;
    btnPesquisar: TcxButton;
    dxLayoutControl1Item5: TdxLayoutItem;
    dxLayoutControl1Group3: TdxLayoutGroup;
    grdHinarioDBTableView1: TcxGridDBTableView;
    grdHinarioLevel1: TcxGridLevel;
    grdHinario: TcxGrid;
    dxLayoutControl1Item6: TdxLayoutItem;
    grdHinarioDBTableView1NUMERO: TcxGridDBColumn;
    grdHinarioDBTableView1TITULO: TcxGridDBColumn;
    cxDBMemo1: TcxDBMemo;
    dxLayoutControl1Item7: TdxLayoutItem;
    dxLayoutControl1Group4: TdxLayoutGroup;
    qrPesquisa: TUniQuery;
    dsPesquisa: TDataSource;
    qrPesquisaID: TIntegerField;
    qrPesquisaNUMERO: TFloatField;
    qrPesquisaTITULO: TMemoField;
    qrPesquisaLETRA: TMemoField;
    cxLabel1: TcxLabel;
    dxLayoutControl1Item8: TdxLayoutItem;
    dxLayoutControl1Group5: TdxLayoutGroup;
    dxLayoutControl1Group7: TdxLayoutGroup;
    procedure FormCreate(Sender: TObject);
    procedure edSelecaoNumeroPropertiesChange(Sender: TObject);
    procedure btnPesquisarClick(Sender: TObject);
    procedure edSelecaoNumeroKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  dfmHinarioAdventista: TdfmHinarioAdventista;

implementation

uses uDMVisual, uDMConexao, uDB, uRotinas, uGlobal;

{$R *.dfm}

procedure TdfmHinarioAdventista.btnPesquisarClick(Sender: TObject);
begin
   qrPesquisa.Close;
   qrPesquisa.Open;
end;

procedure TdfmHinarioAdventista.edSelecaoNumeroKeyPress(Sender: TObject;
  var Key: Char);
begin
   if Key = #13 then
      TRotinas.ShellExecute(TRotinas.GetFullPath(PARAMETROS.LocalHinario) + FormatFloat('00#', edSelecaoNumero.Value) + '.pps');
end;

procedure TdfmHinarioAdventista.edSelecaoNumeroPropertiesChange(
  Sender: TObject);
begin
   qrHinario.Locate('NUMERO', edSelecaoNumero.Value, []);
end;

procedure TdfmHinarioAdventista.FormCreate(Sender: TObject);
begin
   qrHinario.Open;
end;

end.
